package com.basketball.gym.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.basketball.gym.pojo.ResponseData;
import com.basketball.gym.pojo.User;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.IOException;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author 赵肖云
 * @since 2021-03-15
 */
public interface UserService extends IService<User> {

    /**
     * 登录
     */
    ResponseData<User> login(@NotNull(message = "code不能为空") String code);

    /**
     * 更新用户信息
     */
    ResponseData<User> updateInfo(@NotNull(message = "encryptedData不能为空") String encryptedData, @NotNull(message = "iv不能为空") String iv, User user);

    /**
     * 退出登录
     */
    ResponseData<Object> logout(User user);

    /**
     * 更新token
     */
    ResponseData<Object> refresh(String refreshToken);

    /**
     * 获取当前登录的用户
     */
    ResponseData<User> getUser(User user);

    /**
     * 上传图片
     */
    ResponseData<Object> uploadPhoto(MultipartFile photo, User user) throws IOException;

    /**
     * 更改头像
     */
    ResponseData<Object> updateAvatar(User user);

    /**
     * 获取绑定手机号时的验证码
     */
    ResponseData<Object> getBindCode(String phone, User user);

    /**
     * 获取更换手机号时的验证码
     */
    ResponseData<Object> getUpdateCode(String phone, User user);

    /**
     * 绑定/更换手机号
     */
    ResponseData<Object> bindPhone(@NotNull(message = "phone不能为空") @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "手机号格式错误") String phone, @NotNull(message = "code不能为空") String code, User user);
}
